package test3;

import java.util.Scanner;

public class MyDays {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入年份");
        int year=sc.nextInt();
        System.out.println("请输入月份");
        int mon=sc.nextInt();
        System.out.println("请输入日期");
        int days=sc.nextInt();
        MyDays m=new MyDays();
        m.day(year,mon,days);
    }

    public void day(int year,int mon,int day){
        int days=day;
        for (int i = 1; i < mon; i++) {
            switch (i){
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:days+=31;
                    break;
                case 2:
                    if (year%4==0&&year%100!=0||year%400==0){
                        days+=29; break;
                    }else{
                        days+=28; break;
                    }
                case 4:
                case 6:
                case 9:
                case 11:
                    days+=30;
                    break;
                default:
                    System.out.println("没有这个月份");
                    break;
            }
        }
        System.out.println("一共经历了"+days+"天");
    }
}
